package com.fast.common.utils;

import org.springframework.web.socket.TextMessage;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;

public class MessageBuilder {
	
	public static TextMessage position(String type, int position) {
		
		ObjectMapper objectMapper = new ObjectMapper();
		ObjectNode json = objectMapper.createObjectNode();
		json.put("type", type);
		json.put("text", String.valueOf(position));
		
		return new TextMessage(json.toString());
		
	}
	
	public static TextMessage finish(String type) {
		
		ObjectMapper objectMapper = new ObjectMapper();
		ObjectNode json = objectMapper.createObjectNode();
		json.put("type", type);
		
		return new TextMessage(json.toString());
		
	}

}
